using NUnit.Framework;
using System.Collections.Generic;

namespace math.test.BitArray
{
    public class BitArrayTest1
    {
        [SetUp]
        public void Setup()
        {
        }

        [Test]
        public void Test1()
        {
            JustMathCore.BitArray barray = JustMathCore.BitArray.Create();
            for (uint i = 0; i < 100; i++)
            {
                barray[i] = true;
            }
            for (uint i = 0; i < 100; i++)
            {
                barray[i] = false;
            }
            List<uint> test = new List<uint>();
            System.Random ran = new System.Random();
            for (var i = 0; i < 10000; i++)
            {
                var num = (uint)ran.Next();
                test.Add(num);

                barray[num] = true;
            }
            int inlist = 0;
            int outlist = 0;
            foreach (var l in test)
            {
                var b = barray[l];
                if (b == false)
                    Assert.Fail();
                var b2 = barray[l + 1];
                if (b2)
                    inlist++;
                else
                    outlist++;
            }
            System.Console.WriteLine("inlist=" + inlist + " outlist=" + outlist);
            Assert.Pass();
        }
    }
}